﻿<!doctype html>
<html>
	<head>
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
		<title>优惠劵列表</title>
		<link href="css/style.css" rel="stylesheet" type="text/css">
		<link href="css/Pager.css" type="text/css" rel="stylesheet" />
		<script type="text/javascript" src="js/jquery-1.9.1.js"></script>
		<script type="text/javascript" src="js/jquery.pager.js"></script>
		<script type="text/javascript" src="js/common.js"></script>
		<script type="text/javascript" src="js/utils.js"></script>
		<script type="text/javascript" src="js/openId1.js"></script>
		<script type="text/javascript" src="js/qmsk-1.2.js"></script>
		<script type="text/javascript">
			var _p = 0;
			$(function() {
				var thisShopId =getIdByName("thisShopId");
				getCoupon(thisShopId);
			});
			function getCoupon(thisShopId) {
				new qmsk.SiglePinterest({
					url : '../couponRule/find/allCoupon', // 请求地址，插件会自动在 url 后追加 /n/n
					initPage : 5, // 首次加载页数
					size : 1, // 每次加载数量，即每页的大小
					success : printDataToPage, // 成功回调
					valves : 100, //当滚动条距离底部该像素的时候加载
					data:{'shopId':thisShopId},
					loading : addRefresh,
					loaded : delRefresh
				});
				/* $.ajax({
				 url:'../../../couponRule/find/allCoupon',
				 type:'get',
				 async:false,
				 data:{'typeId':6,'shopId':_shopId},
				 success:function(data){
				 var dt = JSON.parse(data);
				 var nameList= new Array();
				 if(dt.state==0){
				 for(var i = 0;i<dt.result.data.length;i++){
				 var keyWord = getHtmlString(getHeadIndexValue(i, dt, "keyWord"))
				 var dl="<dl onclick='toS("+getHtmlString(getHeadIndexValue(i, dt, "id"))+","+flag+")' class=\"shopInside news\"><dt><img src=\""+getHtmlString(getHeadIndexValue(i, dt, "imageUrl"))+"\"></dt><dd><strong class=\"title\">"+getHtmlString(getHeadIndexValue(i, dt, "title"))+"</strong><p>"+getHtmlString(getHeadIndexValue(i, dt, "memo"))+" </p></dd></dl>"
				 var index= getHtmlString(getHeadIndexValue(i, dt, "indexUrl"))

				 }
				 }
				 }
				 }); */
			}

			function printDataToPage(dt) {
				var htm = "";
				if (dt.row == 0) {
					if (_p == 0) {
						$("#noResult").show();
					}
				}
				_p = 1;
				for (var i = 0; i < dt.row; i++) {
					var index = dt.getValue("indexUrl", i);
					var flag = false;
					if (IsEmpty(index)) {
						flag = true;
					}
					var htm = "<div class=\"actor\"><dl  onclick=\"gos(" + dt.getValue("RuleID", i) + ")\"  ><dt><img src=\"" + dt.getValue("imageUrl", i) + "\"></dt><dd><p><strong>" + dt.getValue("RuleName", i) + "</strong><span class='download'>总下载<span class='red'>" + dt.getValue("usedNum", i) + "</span>次</span><p><p>生效时间：<span>" + dt.getValue("EffectDate", i).substring(0, 10) + "</span>至截止时间<span>" + dt.getValue("UneffectDate", i).substring(0, 10) + "</span></p></dd></dl></div>";
					$("#activityList").append(htm);
				}

			}

			function gos(url) {
				if (IsNotEmpty(url)) {

					window.location.href = 'couponsDetil.html?shopId=' + _shopId + "&openId=" + _openId + "&id=" + url;
				}
			}

		</script>
	</head>

	<body style="background:#ddd;">
		<div class="wrapper">
			<div class="container" id="activityList" >
				<div id="noResult" style="height: 265px; width: 100%; background: url(images/sale.jpg) no-repeat center 62px #f6f6f6; text-align: center;display: none;">
					<P style="padding-top: 150px; font-family: Microsoft YaHei; color: #cdcdcd; font-size: 16px;">
						暂时没有优惠，常来看看有惊喜哦！
					</P>
				</div>
			</div>
		</div>
	</body>
</html>
